package cn.springcloud.provider.controller;

import cn.springcloud.api.model.User;
import cn.springcloud.provider.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author gc
 * @Date 2019/12/9 15:04  周一
 * @Description
 */

@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService ;

    @RequestMapping("/getUser")
    @ResponseBody
    public List<User> getUser(){
        return userService.findAll();
    }
    @RequestMapping("/{id}")
    @ResponseBody
    public User getUser(@PathVariable String id){
        return userService.findById(id);
    }






}
